import java.util.Arrays;

public class t338 {
    public static void main(String[] args) {
        int n = 5;
        System.out.println(Arrays.toString(countBits(n)));
    }
    public static int[] countBits(int n) {
        int arr[] = new int[n+1];
        arr[0] = 0;
        for (int i = 1; i <= n; i++) {
            int p = 0;
            int tmp = i;
            while (tmp>0){
                p++;
                tmp &= (tmp-1);
            }
            arr[i] = p;
        }
        return arr;
    }
}
